package 并发编程16.实际运用场景;

import java.util.concurrent.DelayQueue;

/**
 * @author idea
 * @data 2019/2/10
 */
public class Teacher implements Runnable {

    private DelayQueue<Student> delayQueue;

    public Teacher(DelayQueue<Student> delayQueue) {
        this.delayQueue = delayQueue;
    }


    @Override
    public void run() {
        System.out.println("test start");
        try {
            while(!Thread.interrupted()){
                delayQueue.take().run();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }


}
